Descriptives
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 1", "Block 2", "Block 3"))
descriptives_a <- nirs_per_trial_plus_qst %>%
select(record_id, block, trial, avg_score, DLPFC_avg_score, VLPFC_avg_score) %>%
group_by(block) %>%
summarise(
PFC_mean = round(mean(avg_score, na.rm = TRUE), 2),
DLPFC_mean = round(mean(DLPFC_avg_score, na.rm = TRUE), 2),
VLPFC_mean = round(mean(VLPFC_avg_score, na.rm = TRUE), 2),
PFC_sd = round(sd(avg_score, na.rm = TRUE), 2),
DLPFC_sd = round(sd(DLPFC_avg_score, na.rm = TRUE), 2),
VLPFC_sd = round(sd(VLPFC_avg_score, na.rm = TRUE), 2),
PFC_min = round(min(avg_score, na.rm = TRUE), 2),
DLPFC_min = round(min(DLPFC_avg_score, na.rm = TRUE), 2),
VLPFC_min = round(min(VLPFC_avg_score, na.rm = TRUE), 2),
PFC_max = round(max(avg_score, na.rm = TRUE), 2),
DLPFC_max = round(max(DLPFC_avg_score, na.rm = TRUE), 2),
VLPFC_max = round(max(VLPFC_avg_score, na.rm = TRUE), 2)
) %>%
ungroup() %>%
pivot_longer(PFC_mean:VLPFC_max, names_to = c("ROI", "stat"), names_sep = "_", values_to = "value") %>%
arrange(ROI) %>%
unite("name", c("ROI", "block"))
block1 %>%
select(stai_trait, stai_state, cbq_effortful_control, cbq_fear, anxiety_c) %>%
pivot_longer(stai_trait:anxiety_c, names_to = "name", values_to = "value") %>%
group_by(name) %>%
summarize(
mean = round(mean(value, na.rm = TRUE), 2),
sd = round(sd(value, na.rm = TRUE), 2),
min = round(min(value, na.rm = TRUE), 2),
max = round(max(value, na.rm = TRUE), 2)
) %>%
pivot_longer(mean:max, names_to = "stat", values_to = "value") %>%
rbind(descriptives_a) %>%
pivot_wider(names_from = stat, values_from = value) %>%
mutate(
"Mean (SD)" = paste0(mean, " (", sd, ")"),
Range = paste0(min, "-", max),
name = as.factor(name)
) %>%
select(name, "Mean (SD)", "Range") %>%
gt()
| name |
Mean (SD) |
Range |
| anxiety_c |
0.43 (0.26) |
0-1.1 |
| cbq_effortful_control |
5.18 (0.63) |
3.27-6.35 |
| cbq_fear |
3.96 (1.06) |
1.67-7 |
| stai_state |
32.73 (9.17) |
18-62 |
| stai_trait |
36.62 (8.89) |
20-62 |
| DLPFC_Block 1 |
0.34 (0.05) |
0.18-0.49 |
| DLPFC_Block 2 |
0.37 (0.06) |
0.16-0.58 |
| DLPFC_Block 3 |
0.34 (0.05) |
0.2-0.53 |
| PFC_Block 1 |
0.34 (0.03) |
0.24-0.44 |
| PFC_Block 2 |
0.36 (0.04) |
0.27-0.48 |
| PFC_Block 3 |
0.34 (0.03) |
0.27-0.47 |
| VLPFC_Block 1 |
0.34 (0.04) |
0.24-0.48 |
| VLPFC_Block 2 |
0.36 (0.04) |
0.25-0.52 |
| VLPFC_Block 3 |
0.34 (0.04) |
0.25-0.47 |
Correlations
Table
corr_df <- block1 %>%
select(stai_trait, stai_state, cbq_effortful_control, cbq_fear, anxiety_c, c_age_m)
# ++++++++++++++++++++++++++++
# flattenCorrMatrix
# ++++++++++++++++++++++++++++
# cormat : matrix of the correlation coefficients
# pmat : matrix of the correlation p-values
flattenCorrMatrix <- function(cormat, pmat) {
ut <- upper.tri(cormat)
data.frame(
row = rownames(cormat)[row(cormat)[ut]],
column = rownames(cormat)[col(cormat)[ut]],
cor = round((cormat)[ut], 2),
p = round(pmat[ut], 6)
)
}
res2 <- rcorr(as.matrix(corr_df))
res3 <- flattenCorrMatrix(res2$r, res2$P)
res3 %>%
mutate(test = paste0("r = ", cor, ", p = ", p)) %>%
select(row, column, test) %>%
pivot_wider(names_from = column, values_from = test)
Individual
report(cor.test(block1$stai_state, block1$anxiety_c, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_state and
## block1$anxiety_c is positive, statistically significant, and medium (r = 0.29,
## 95% CI [0.20, 0.37], t(432) = 6.22, p < .001)
report(cor.test(block1$stai_state, block1$cbq_effortful_control, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_state and
## block1$cbq_effortful_control is negative, statistically significant, and small
## (r = -0.16, 95% CI [-0.25, -0.07], t(432) = -3.43, p < .001)
report(cor.test(block1$stai_state, block1$cbq_fear, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_state and
## block1$cbq_fear is positive, statistically significant, and small (r = 0.18,
## 95% CI [0.08, 0.27], t(432) = 3.74, p < .001)
report(cor.test(block1$stai_trait, block1$anxiety_c, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_trait and
## block1$anxiety_c is positive, statistically significant, and large (r = 0.32,
## 95% CI [0.24, 0.41], t(432) = 7.10, p < .001)
report(cor.test(block1$stai_trait, block1$cbq_effortful_control, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_trait and
## block1$cbq_effortful_control is negative, statistically not significant, and
## tiny (r = -0.03, 95% CI [-0.12, 0.06], t(432) = -0.62, p = 0.536)
report(cor.test(block1$stai_trait, block1$cbq_fear, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_trait and
## block1$cbq_fear is positive, statistically significant, and very small (r =
## 0.09, 95% CI [1.01e-04, 0.19], t(432) = 1.97, p = 0.050)
report(cor.test(block1$cbq_fear, block1$cbq_effortful_control, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$cbq_fear and
## block1$cbq_effortful_control is positive, statistically not significant, and
## tiny (r = 0.02, 95% CI [-0.08, 0.11], t(432) = 0.36, p = 0.721)
report(cor.test(block1$stai_state, block1$stai_trait, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$stai_state and
## block1$stai_trait is positive, statistically significant, and very large (r =
## 0.78, 95% CI [0.75, 0.82], t(432) = 26.31, p < .001)
report(cor.test(block1$anxiety_c, block1$cbq_fear, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$anxiety_c and
## block1$cbq_fear is positive, statistically significant, and very large (r =
## 0.46, 95% CI [0.39, 0.54], t(432) = 10.90, p < .001)
report(cor.test(block1$anxiety_c, block1$cbq_effortful_control, method = "pearson", conf.level = 0.95))
## Effect sizes were labelled following Funder's (2019) recommendations.
##
## The Pearson's product-moment correlation between block1$anxiety_c and
## block1$cbq_effortful_control is positive, statistically not significant, and
## tiny (r = 0.04, 95% CI [-0.05, 0.13], t(432) = 0.82, p = 0.413)
PFC
State - Model -block 2 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 2", "Block 1", "Block 3"))
model3_1 <- lmer(
avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_state * block + (1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
summary(model3_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## avg_score ~ c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control *
## block + anxiety_c * block + stai_state * block + (1 + block |
## record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -4928
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9104 -0.6489 -0.0480 0.6275 3.7492
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 0.0001783 0.01335
## blockBlock 1 0.0002928 0.01711 -1.00
## blockBlock 3 0.0001259 0.01122 -1.00 1.00
## trial (Intercept) 0.0000000 0.00000
## Residual 0.0011190 0.03345
## Number of obs: 1303, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3.317e-01 2.095e-02 1.094e+02 15.834
## c_age_y_centered 4.911e-04 8.499e-04 3.217e+02 0.578
## c_sexF 2.854e-04 2.083e-03 3.232e+02 0.137
## cbq_fear -1.090e-04 2.204e-03 1.077e+02 -0.049
## blockBlock 1 2.357e-02 2.843e-02 1.126e+02 0.829
## blockBlock 3 2.415e-02 2.549e-02 1.525e+02 0.947
## cbq_effortful_control 5.967e-03 3.346e-03 1.113e+02 1.783
## anxiety_c -1.718e-03 9.041e-03 1.075e+02 -0.190
## stai_state 7.044e-05 2.387e-04 1.078e+02 0.295
## cbq_fear:blockBlock 1 -6.833e-04 3.004e-03 1.125e+02 -0.227
## cbq_fear:blockBlock 3 5.726e-05 2.706e-03 1.554e+02 0.021
## blockBlock 1:cbq_effortful_control -7.946e-03 4.517e-03 1.127e+02 -1.759
## blockBlock 3:cbq_effortful_control -9.370e-03 4.051e-03 1.529e+02 -2.313
## blockBlock 1:anxiety_c 4.901e-03 1.234e-02 1.126e+02 0.397
## blockBlock 3:anxiety_c -3.392e-03 1.106e-02 1.525e+02 -0.307
## blockBlock 1:stai_state -9.587e-05 3.253e-04 1.124e+02 -0.295
## blockBlock 3:stai_state 1.256e-04 2.925e-04 1.542e+02 0.430
## Pr(>|t|)
## (Intercept) <2e-16 ***
## c_age_y_centered 0.5638
## c_sexF 0.8911
## cbq_fear 0.9606
## blockBlock 1 0.4087
## blockBlock 3 0.3449
## cbq_effortful_control 0.0773 .
## anxiety_c 0.8496
## stai_state 0.7685
## cbq_fear:blockBlock 1 0.8205
## cbq_fear:blockBlock 3 0.9831
## blockBlock 1:cbq_effortful_control 0.0813 .
## blockBlock 3:cbq_effortful_control 0.0221 *
## blockBlock 1:anxiety_c 0.6919
## blockBlock 3:anxiety_c 0.7594
## blockBlock 1:stai_state 0.7687
## blockBlock 3:stai_state 0.6681
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_1, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_1, type = "III")
report(model3_1)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_state (formula: avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_state * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.09. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 2, cbq_effortful_control = 0, anxiety_c = 0 and stai_state =
## 0, is at 0.33 (95% CI [0.29, 0.37], t(1278) = 15.83, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically non-significant and positive
## (beta = 4.91e-04, 95% CI [-1.18e-03, 2.16e-03], t(1278) = 0.58, p = 0.563; Std.
## beta = 0.02, 95% CI [-0.04, 0.07])
## - The effect of c sex [F] is statistically non-significant and positive (beta =
## 2.85e-04, 95% CI [-3.80e-03, 4.37e-03], t(1278) = 0.14, p = 0.891; Std. beta =
## 7.98e-03, 95% CI [-0.11, 0.12])
## - The effect of cbq fear is statistically non-significant and negative (beta =
## -1.09e-04, 95% CI [-4.43e-03, 4.21e-03], t(1278) = -0.05, p = 0.961; Std. beta
## = -3.20e-03, 95% CI [-0.13, 0.12])
## - The effect of block [Block 1] is statistically non-significant and positive
## (beta = 0.02, 95% CI [-0.03, 0.08], t(1278) = 0.83, p = 0.407; Std. beta =
## -0.60, 95% CI [-0.75, -0.44])
## - The effect of block [Block 3] is statistically non-significant and positive
## (beta = 0.02, 95% CI [-0.03, 0.07], t(1278) = 0.95, p = 0.344; Std. beta =
## -0.60, 95% CI [-0.74, -0.46])
## - The effect of cbq effortful control is statistically non-significant and
## positive (beta = 5.97e-03, 95% CI [-5.98e-04, 0.01], t(1278) = 1.78, p = 0.075;
## Std. beta = 0.11, 95% CI [-0.01, 0.22])
## - The effect of anxiety c is statistically non-significant and negative (beta =
## -1.72e-03, 95% CI [-0.02, 0.02], t(1278) = -0.19, p = 0.849; Std. beta = -0.01,
## 95% CI [-0.14, 0.12])
## - The effect of stai state is statistically non-significant and positive (beta
## = 7.04e-05, 95% CI [-3.98e-04, 5.39e-04], t(1278) = 0.30, p = 0.768; Std. beta
## = 0.02, 95% CI [-0.10, 0.14])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## negative (beta = -6.83e-04, 95% CI [-6.58e-03, 5.21e-03], t(1278) = -0.23, p =
## 0.820; Std. beta = -0.02, 95% CI [-0.19, 0.15])
## - The effect of cbq fear × block [Block 3] is statistically non-significant and
## positive (beta = 5.73e-05, 95% CI [-5.25e-03, 5.37e-03], t(1278) = 0.02, p =
## 0.983; Std. beta = 1.68e-03, 95% CI [-0.15, 0.16])
## - The effect of block [Block 1] × cbq effortful control is statistically
## non-significant and negative (beta = -7.95e-03, 95% CI [-0.02, 9.15e-04],
## t(1278) = -1.76, p = 0.079; Std. beta = -0.14, 95% CI [-0.30, 0.02])
## - The effect of block [Block 3] × cbq effortful control is statistically
## significant and negative (beta = -9.37e-03, 95% CI [-0.02, -1.42e-03], t(1278)
## = -2.31, p = 0.021; Std. beta = -0.17, 95% CI [-0.31, -0.03])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 4.90e-03, 95% CI [-0.02, 0.03], t(1278) = 0.40, p = 0.691;
## Std. beta = 0.04, 95% CI [-0.14, 0.22])
## - The effect of block [Block 3] × anxiety c is statistically non-significant
## and negative (beta = -3.39e-03, 95% CI [-0.03, 0.02], t(1278) = -0.31, p =
## 0.759; Std. beta = -0.03, 95% CI [-0.19, 0.14])
## - The effect of block [Block 1] × stai state is statistically non-significant
## and negative (beta = -9.59e-05, 95% CI [-7.34e-04, 5.42e-04], t(1278) = -0.29,
## p = 0.768; Std. beta = -0.02, 95% CI [-0.19, 0.14])
## - The effect of block [Block 3] × stai state is statistically non-significant
## and positive (beta = 1.26e-04, 95% CI [-4.48e-04, 7.00e-04], t(1278) = 0.43, p
## = 0.668; Std. beta = 0.03, 95% CI [-0.11, 0.18])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
model3_1_x <- lmer(
avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_state * block + (1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
model3_1_y <- lmer(
avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_state + (1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
performance::compare_performance(model3_1, model3_1_x, model3_1_y)
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
### model_3_1 is the best model <-
Report
tab_model(model3_1, p.val = "kr", show.df = TRUE)
|
|
avg score
|
|
Predictors
|
Estimates
|
CI
|
p
|
df
|
|
(Intercept)
|
0.33
|
0.29 – 0.37
|
<0.001
|
104.96
|
|
c age y centered
|
0.00
|
-0.00 – 0.00
|
0.572
|
101.80
|
|
c sex [F]
|
0.00
|
-0.00 – 0.00
|
0.893
|
101.91
|
|
cbq fear
|
-0.00
|
-0.00 – 0.00
|
0.961
|
103.47
|
|
block [Block 1]
|
0.02
|
-0.03 – 0.08
|
0.409
|
103.85
|
|
block [Block 3]
|
0.02
|
-0.03 – 0.07
|
0.346
|
103.54
|
|
cbq effortful control
|
0.01
|
-0.00 – 0.01
|
0.078
|
106.77
|
|
anxiety c
|
-0.00
|
-0.02 – 0.02
|
0.850
|
103.26
|
|
stai state
|
0.00
|
-0.00 – 0.00
|
0.769
|
103.50
|
cbq fear × block [Block 1]
|
-0.00
|
-0.01 – 0.01
|
0.821
|
103.78
|
cbq fear × block [Block 3]
|
0.00
|
-0.01 – 0.01
|
0.983
|
104.84
|
block [Block 1] × cbq effortful control
|
-0.01
|
-0.02 – 0.00
|
0.081
|
103.96
|
block [Block 3] × cbq effortful control
|
-0.01
|
-0.02 – -0.00
|
0.023
|
103.73
|
block [Block 1] × anxiety c
|
0.00
|
-0.02 – 0.03
|
0.692
|
103.91
|
block [Block 3] × anxiety c
|
-0.00
|
-0.03 – 0.02
|
0.760
|
103.54
|
block [Block 1] × stai state
|
-0.00
|
-0.00 – 0.00
|
0.769
|
103.70
|
block [Block 3] × stai state
|
0.00
|
-0.00 – 0.00
|
0.668
|
104.31
|
|
Random Effects
|
|
σ2
|
0.00
|
|
τ00 record_id
|
0.00
|
|
τ00 trial
|
0.00
|
|
τ11 record_id.blockBlock 1
|
0.00
|
|
τ11 record_id.blockBlock 3
|
0.00
|
|
ρ01 record_id.blockBlock 1
|
-1.00
|
|
ρ01 record_id.blockBlock 3
|
-1.00
|
|
N record_id
|
109
|
|
N trial
|
4
|
|
Observations
|
1303
|
|
Marginal R2 / Conditional R2
|
0.090 / NA
|
Plot for interaction: EC
interaction_eff3_1 <- ggpredict(model3_1, c("cbq_effortful_control", "block"))
interaction_eff3_1
ggplot(interaction_eff3_1, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Effortful Control (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "PFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_EC-Block_state_PFC.png", width = 10, height = 8)
Trait - Model -block 2 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 2", "Block 1", "Block 3"))
model3_2 <- lmer(
avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_trait * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
summary(model3_2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## avg_score ~ c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control *
## block + anxiety_c * block + stai_trait * block + (1 + block |
## record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -4930.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9192 -0.6358 -0.0481 0.6335 3.7537
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 0.0001719 0.01311
## blockBlock 1 0.0002851 0.01688 -1.00
## blockBlock 3 0.0001271 0.01127 -1.00 1.00
## trial (Intercept) 0.0000000 0.00000
## Residual 0.0011187 0.03345
## Number of obs: 1303, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3.234e-01 2.057e-02 1.090e+02 15.720
## c_age_y_centered 4.483e-04 8.460e-04 3.345e+02 0.530
## c_sexF 2.997e-04 2.067e-03 3.358e+02 0.145
## cbq_fear 1.033e-04 2.190e-03 1.079e+02 0.047
## blockBlock 1 3.264e-02 2.802e-02 1.127e+02 1.165
## blockBlock 3 3.064e-02 2.526e-02 1.500e+02 1.213
## cbq_effortful_control 5.961e-03 3.268e-03 1.112e+02 1.824
## anxiety_c -4.712e-03 9.182e-03 1.076e+02 -0.513
## stai_trait 3.037e-04 2.438e-04 1.077e+02 1.246
## cbq_fear:blockBlock 1 -9.399e-04 2.993e-03 1.127e+02 -0.314
## cbq_fear:blockBlock 3 1.007e-04 2.709e-03 1.525e+02 0.037
## blockBlock 1:cbq_effortful_control -7.915e-03 4.425e-03 1.129e+02 -1.789
## blockBlock 3:cbq_effortful_control -9.715e-03 3.989e-03 1.502e+02 -2.436
## blockBlock 1:anxiety_c 8.211e-03 1.256e-02 1.128e+02 0.654
## blockBlock 3:anxiety_c -1.753e-03 1.132e-02 1.502e+02 -0.155
## blockBlock 1:stai_trait -3.492e-04 3.332e-04 1.126e+02 -1.048
## blockBlock 3:stai_trait -4.031e-05 3.007e-04 1.504e+02 -0.134
## Pr(>|t|)
## (Intercept) <2e-16 ***
## c_age_y_centered 0.5965
## c_sexF 0.8848
## cbq_fear 0.9625
## blockBlock 1 0.2465
## blockBlock 3 0.2270
## cbq_effortful_control 0.0708 .
## anxiety_c 0.6089
## stai_trait 0.2156
## cbq_fear:blockBlock 1 0.7541
## cbq_fear:blockBlock 3 0.9704
## blockBlock 1:cbq_effortful_control 0.0763 .
## blockBlock 3:cbq_effortful_control 0.0160 *
## blockBlock 1:anxiety_c 0.5147
## blockBlock 3:anxiety_c 0.8772
## blockBlock 1:stai_trait 0.2970
## blockBlock 3:stai_trait 0.8935
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_2, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_2, type = "III")
report(model3_2)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_trait (formula: avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_trait * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.09. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 2, cbq_effortful_control = 0, anxiety_c = 0 and stai_trait =
## 0, is at 0.32 (95% CI [0.28, 0.36], t(1278) = 15.72, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically non-significant and positive
## (beta = 4.48e-04, 95% CI [-1.21e-03, 2.11e-03], t(1278) = 0.53, p = 0.596; Std.
## beta = 0.02, 95% CI [-0.04, 0.07])
## - The effect of c sex [F] is statistically non-significant and positive (beta =
## 3.00e-04, 95% CI [-3.75e-03, 4.35e-03], t(1278) = 0.15, p = 0.885; Std. beta =
## 8.38e-03, 95% CI [-0.10, 0.12])
## - The effect of cbq fear is statistically non-significant and positive (beta =
## 1.03e-04, 95% CI [-4.19e-03, 4.40e-03], t(1278) = 0.05, p = 0.962; Std. beta =
## 3.04e-03, 95% CI [-0.12, 0.13])
## - The effect of block [Block 1] is statistically non-significant and positive
## (beta = 0.03, 95% CI [-0.02, 0.09], t(1278) = 1.16, p = 0.244; Std. beta =
## -0.60, 95% CI [-0.75, -0.44])
## - The effect of block [Block 3] is statistically non-significant and positive
## (beta = 0.03, 95% CI [-0.02, 0.08], t(1278) = 1.21, p = 0.225; Std. beta =
## -0.60, 95% CI [-0.74, -0.46])
## - The effect of cbq effortful control is statistically non-significant and
## positive (beta = 5.96e-03, 95% CI [-4.50e-04, 0.01], t(1278) = 1.82, p = 0.068;
## Std. beta = 0.11, 95% CI [-7.94e-03, 0.22])
## - The effect of anxiety c is statistically non-significant and negative (beta =
## -4.71e-03, 95% CI [-0.02, 0.01], t(1278) = -0.51, p = 0.608; Std. beta = -0.03,
## 95% CI [-0.17, 0.10])
## - The effect of stai trait is statistically non-significant and positive (beta
## = 3.04e-04, 95% CI [-1.75e-04, 7.82e-04], t(1278) = 1.25, p = 0.213; Std. beta
## = 0.08, 95% CI [-0.04, 0.19])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## negative (beta = -9.40e-04, 95% CI [-6.81e-03, 4.93e-03], t(1278) = -0.31, p =
## 0.754; Std. beta = -0.03, 95% CI [-0.20, 0.15])
## - The effect of cbq fear × block [Block 3] is statistically non-significant and
## positive (beta = 1.01e-04, 95% CI [-5.21e-03, 5.42e-03], t(1278) = 0.04, p =
## 0.970; Std. beta = 2.96e-03, 95% CI [-0.15, 0.16])
## - The effect of block [Block 1] × cbq effortful control is statistically
## non-significant and negative (beta = -7.92e-03, 95% CI [-0.02, 7.66e-04],
## t(1278) = -1.79, p = 0.074; Std. beta = -0.14, 95% CI [-0.29, 0.01])
## - The effect of block [Block 3] × cbq effortful control is statistically
## significant and negative (beta = -9.72e-03, 95% CI [-0.02, -1.89e-03], t(1278)
## = -2.44, p = 0.015; Std. beta = -0.17, 95% CI [-0.31, -0.03])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 8.21e-03, 95% CI [-0.02, 0.03], t(1278) = 0.65, p = 0.513;
## Std. beta = 0.06, 95% CI [-0.12, 0.24])
## - The effect of block [Block 3] × anxiety c is statistically non-significant
## and negative (beta = -1.75e-03, 95% CI [-0.02, 0.02], t(1278) = -0.15, p =
## 0.877; Std. beta = -0.01, 95% CI [-0.18, 0.15])
## - The effect of block [Block 1] × stai trait is statistically non-significant
## and negative (beta = -3.49e-04, 95% CI [-1.00e-03, 3.05e-04], t(1278) = -1.05,
## p = 0.295; Std. beta = -0.09, 95% CI [-0.25, 0.08])
## - The effect of block [Block 3] × stai trait is statistically non-significant
## and negative (beta = -4.03e-05, 95% CI [-6.30e-04, 5.50e-04], t(1278) = -0.13,
## p = 0.893; Std. beta = -1.00e-02, 95% CI [-0.16, 0.14])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
performance::check_outliers(model3_2)
## OK: No outliers detected.
## - Based on the following method and threshold: cook (0.907).
## - For variable: (Whole model)
model3_2_x <- lmer(
avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_trait * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
model3_2_y <- lmer(
avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_trait +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
performance::compare_performance(model3_2, model3_2_x, model3_2_y)
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
Plot for interaction: EC
interaction_eff3_2 <- ggpredict(model3_2, c("cbq_effortful_control", "block"))
interaction_eff3_2
ggplot(interaction_eff3_2, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Effortful Control (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "PFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_EC-Block_trait_PFC.png", width = 10, height = 8)
DLPFC
State - Model -block 2 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 2", "Block 1", "Block 3"))
model3_3 <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_state * block
+ (1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
summary(model3_3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: DLPFC_avg_score ~ c_age_y_centered + c_sex + cbq_fear * block +
## cbq_effortful_control * block + anxiety_c * block + stai_state *
## block + (1 + block | record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -3606.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2594 -0.6981 -0.0131 0.6264 3.6368
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 0.0003510 0.01874
## blockBlock 1 0.0003852 0.01963 -1.00
## blockBlock 3 0.0005459 0.02337 -1.00 1.00
## trial (Intercept) 0.0000000 0.00000
## Residual 0.0028138 0.05305
## Number of obs: 1254, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3.062e-01 3.210e-02 1.012e+02 9.538
## c_age_y_centered 2.736e-03 1.350e-03 4.470e+02 2.027
## c_sexF -9.361e-04 3.312e-03 4.478e+02 -0.283
## cbq_fear 7.544e-03 3.406e-03 1.008e+02 2.215
## blockBlock 1 1.506e-02 4.161e-02 1.257e+02 0.362
## blockBlock 3 7.718e-02 4.342e-02 1.094e+02 1.778
## cbq_effortful_control 5.302e-03 5.128e-03 1.031e+02 1.034
## anxiety_c -6.767e-03 1.398e-02 1.014e+02 -0.484
## stai_state 1.770e-04 3.662e-04 9.997e+01 0.483
## cbq_fear:blockBlock 1 -7.124e-03 4.417e-03 1.265e+02 -1.613
## cbq_fear:blockBlock 3 -1.149e-02 4.637e-03 1.129e+02 -2.478
## blockBlock 1:cbq_effortful_control -2.132e-03 6.614e-03 1.263e+02 -0.322
## blockBlock 3:cbq_effortful_control -1.311e-02 6.912e-03 1.104e+02 -1.897
## blockBlock 1:anxiety_c 1.947e-02 1.820e-02 1.288e+02 1.069
## blockBlock 3:anxiety_c 1.241e-02 1.892e-02 1.107e+02 0.656
## blockBlock 1:stai_state -1.581e-04 4.767e-04 1.258e+02 -0.332
## blockBlock 3:stai_state 1.955e-04 4.978e-04 1.099e+02 0.393
## Pr(>|t|)
## (Intercept) 9.24e-16 ***
## c_age_y_centered 0.0433 *
## c_sexF 0.7776
## cbq_fear 0.0290 *
## blockBlock 1 0.7180
## blockBlock 3 0.0782 .
## cbq_effortful_control 0.3035
## anxiety_c 0.6294
## stai_state 0.6300
## cbq_fear:blockBlock 1 0.1093
## cbq_fear:blockBlock 3 0.0147 *
## blockBlock 1:cbq_effortful_control 0.7477
## blockBlock 3:cbq_effortful_control 0.0605 .
## blockBlock 1:anxiety_c 0.2869
## blockBlock 3:anxiety_c 0.5135
## blockBlock 1:stai_state 0.7408
## blockBlock 3:stai_state 0.6953
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_3, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_3, type = "III")
report(model3_3)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict DLPFC_avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_state (formula: DLPFC_avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_state * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.06. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 2, cbq_effortful_control = 0, anxiety_c = 0 and stai_state =
## 0, is at 0.31 (95% CI [0.24, 0.37], t(1229) = 9.54, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically significant and positive
## (beta = 2.74e-03, 95% CI [8.74e-05, 5.39e-03], t(1229) = 2.03, p = 0.043; Std.
## beta = 0.06, 95% CI [1.90e-03, 0.12])
## - The effect of c sex [F] is statistically non-significant and negative (beta =
## -9.36e-04, 95% CI [-7.43e-03, 5.56e-03], t(1229) = -0.28, p = 0.777; Std. beta
## = -0.02, 95% CI [-0.13, 0.10])
## - The effect of cbq fear is statistically significant and positive (beta =
## 7.54e-03, 95% CI [8.61e-04, 0.01], t(1229) = 2.21, p = 0.027; Std. beta = 0.14,
## 95% CI [0.02, 0.27])
## - The effect of block [Block 1] is statistically non-significant and positive
## (beta = 0.02, 95% CI [-0.07, 0.10], t(1229) = 0.36, p = 0.717; Std. beta =
## -0.38, 95% CI [-0.53, -0.23])
## - The effect of block [Block 3] is statistically non-significant and positive
## (beta = 0.08, 95% CI [-8.00e-03, 0.16], t(1229) = 1.78, p = 0.076; Std. beta =
## -0.44, 95% CI [-0.59, -0.29])
## - The effect of cbq effortful control is statistically non-significant and
## positive (beta = 5.30e-03, 95% CI [-4.76e-03, 0.02], t(1229) = 1.03, p = 0.301;
## Std. beta = 0.06, 95% CI [-0.05, 0.18])
## - The effect of anxiety c is statistically non-significant and negative (beta =
## -6.77e-03, 95% CI [-0.03, 0.02], t(1229) = -0.48, p = 0.628; Std. beta = -0.03,
## 95% CI [-0.16, 0.10])
## - The effect of stai state is statistically non-significant and positive (beta
## = 1.77e-04, 95% CI [-5.41e-04, 8.95e-04], t(1229) = 0.48, p = 0.629; Std. beta
## = 0.03, 95% CI [-0.09, 0.15])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## negative (beta = -7.12e-03, 95% CI [-0.02, 1.54e-03], t(1229) = -1.61, p =
## 0.107; Std. beta = -0.14, 95% CI [-0.30, 0.03])
## - The effect of cbq fear × block [Block 3] is statistically significant and
## negative (beta = -0.01, 95% CI [-0.02, -2.39e-03], t(1229) = -2.48, p = 0.013;
## Std. beta = -0.22, 95% CI [-0.39, -0.05])
## - The effect of block [Block 1] × cbq effortful control is statistically
## non-significant and negative (beta = -2.13e-03, 95% CI [-0.02, 0.01], t(1229) =
## -0.32, p = 0.747; Std. beta = -0.02, 95% CI [-0.17, 0.12])
## - The effect of block [Block 3] × cbq effortful control is statistically
## non-significant and negative (beta = -0.01, 95% CI [-0.03, 4.51e-04], t(1229) =
## -1.90, p = 0.058; Std. beta = -0.15, 95% CI [-0.31, 5.17e-03])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 0.02, 95% CI [-0.02, 0.06], t(1229) = 1.07, p = 0.285;
## Std. beta = 0.09, 95% CI [-0.08, 0.26])
## - The effect of block [Block 3] × anxiety c is statistically non-significant
## and positive (beta = 0.01, 95% CI [-0.02, 0.05], t(1229) = 0.66, p = 0.512;
## Std. beta = 0.06, 95% CI [-0.12, 0.24])
## - The effect of block [Block 1] × stai state is statistically non-significant
## and negative (beta = -1.58e-04, 95% CI [-1.09e-03, 7.77e-04], t(1229) = -0.33,
## p = 0.740; Std. beta = -0.03, 95% CI [-0.18, 0.13])
## - The effect of block [Block 3] × stai state is statistically non-significant
## and positive (beta = 1.95e-04, 95% CI [-7.81e-04, 1.17e-03], t(1229) = 0.39, p
## = 0.695; Std. beta = 0.03, 95% CI [-0.13, 0.20])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
model3_3_x <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_state * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
model3_3_y <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_state +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
performance::compare_performance(model3_3, model3_3_x, model3_3_y)
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## best model is model3_3
Plot for interaction: Fear
interaction_eff3_3 <- ggpredict(model3_3, c("cbq_fear", "block"))
interaction_eff3_3
ggplot(interaction_eff3_3, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Fear (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "DLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_F-Block_state_DLPFC.png", width = 10, height = 8)
Trait - Model -block 2 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 2", "Block 1", "Block 3"))
model3_4 <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_trait * block + (1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
summary(model3_4)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: DLPFC_avg_score ~ c_age_y_centered + c_sex + cbq_fear * block +
## cbq_effortful_control * block + anxiety_c * block + stai_trait *
## block + (1 + block | record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -3608.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2215 -0.6979 -0.0189 0.6367 3.6747
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 0.0003336 0.01826
## blockBlock 1 0.0003708 0.01926 -1.00
## blockBlock 3 0.0005398 0.02323 -1.00 1.00
## trial (Intercept) 0.0000000 0.00000
## Residual 0.0028126 0.05303
## Number of obs: 1254, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 2.949e-01 3.151e-02 1.015e+02 9.359
## c_age_y_centered 2.634e-03 1.344e-03 4.777e+02 1.959
## c_sexF -8.370e-04 3.287e-03 4.793e+02 -0.255
## cbq_fear 7.895e-03 3.378e-03 1.012e+02 2.337
## blockBlock 1 2.655e-02 4.108e-02 1.270e+02 0.646
## blockBlock 3 8.921e-02 4.297e-02 1.093e+02 2.076
## cbq_effortful_control 5.109e-03 5.002e-03 1.034e+02 1.021
## anxiety_c -1.094e-02 1.415e-02 1.015e+02 -0.773
## stai_trait 5.050e-04 3.750e-04 1.005e+02 1.347
## cbq_fear:blockBlock 1 -7.464e-03 4.399e-03 1.271e+02 -1.697
## cbq_fear:blockBlock 3 -1.139e-02 4.630e-03 1.122e+02 -2.461
## blockBlock 1:cbq_effortful_control -2.014e-03 6.488e-03 1.274e+02 -0.310
## blockBlock 3:cbq_effortful_control -1.366e-02 6.791e-03 1.099e+02 -2.012
## blockBlock 1:anxiety_c 2.358e-02 1.850e-02 1.289e+02 1.274
## blockBlock 3:anxiety_c 1.532e-02 1.932e-02 1.102e+02 0.793
## blockBlock 1:stai_trait -4.842e-04 4.886e-04 1.263e+02 -0.991
## blockBlock 3:stai_trait -1.214e-04 5.120e-04 1.095e+02 -0.237
## Pr(>|t|)
## (Intercept) 2.22e-15 ***
## c_age_y_centered 0.0507 .
## c_sexF 0.7991
## cbq_fear 0.0214 *
## blockBlock 1 0.5193
## blockBlock 3 0.0402 *
## cbq_effortful_control 0.3095
## anxiety_c 0.4414
## stai_trait 0.1811
## cbq_fear:blockBlock 1 0.0922 .
## cbq_fear:blockBlock 3 0.0154 *
## blockBlock 1:cbq_effortful_control 0.7567
## blockBlock 3:cbq_effortful_control 0.0467 *
## blockBlock 1:anxiety_c 0.2049
## blockBlock 3:anxiety_c 0.4296
## blockBlock 1:stai_trait 0.3236
## blockBlock 3:stai_trait 0.8131
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_4, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_4, type = "III")
report(model3_4)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict DLPFC_avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_trait (formula: DLPFC_avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_trait * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.06. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 2, cbq_effortful_control = 0, anxiety_c = 0 and stai_trait =
## 0, is at 0.29 (95% CI [0.23, 0.36], t(1229) = 9.36, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically non-significant and positive
## (beta = 2.63e-03, 95% CI [-3.61e-06, 5.27e-03], t(1229) = 1.96, p = 0.050; Std.
## beta = 0.06, 95% CI [-7.83e-05, 0.11])
## - The effect of c sex [F] is statistically non-significant and negative (beta =
## -8.37e-04, 95% CI [-7.29e-03, 5.61e-03], t(1229) = -0.25, p = 0.799; Std. beta
## = -0.02, 95% CI [-0.13, 0.10])
## - The effect of cbq fear is statistically significant and positive (beta =
## 7.89e-03, 95% CI [1.27e-03, 0.01], t(1229) = 2.34, p = 0.020; Std. beta = 0.15,
## 95% CI [0.02, 0.28])
## - The effect of block [Block 1] is statistically non-significant and positive
## (beta = 0.03, 95% CI [-0.05, 0.11], t(1229) = 0.65, p = 0.518; Std. beta =
## -0.38, 95% CI [-0.53, -0.23])
## - The effect of block [Block 3] is statistically significant and positive (beta
## = 0.09, 95% CI [4.91e-03, 0.17], t(1229) = 2.08, p = 0.038; Std. beta = -0.44,
## 95% CI [-0.59, -0.29])
## - The effect of cbq effortful control is statistically non-significant and
## positive (beta = 5.11e-03, 95% CI [-4.70e-03, 0.01], t(1229) = 1.02, p = 0.307;
## Std. beta = 0.06, 95% CI [-0.05, 0.17])
## - The effect of anxiety c is statistically non-significant and negative (beta =
## -0.01, 95% CI [-0.04, 0.02], t(1229) = -0.77, p = 0.440; Std. beta = -0.05, 95%
## CI [-0.18, 0.08])
## - The effect of stai trait is statistically non-significant and positive (beta
## = 5.05e-04, 95% CI [-2.31e-04, 1.24e-03], t(1229) = 1.35, p = 0.178; Std. beta
## = 0.08, 95% CI [-0.04, 0.20])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## negative (beta = -7.46e-03, 95% CI [-0.02, 1.17e-03], t(1229) = -1.70, p =
## 0.090; Std. beta = -0.14, 95% CI [-0.31, 0.02])
## - The effect of cbq fear × block [Block 3] is statistically significant and
## negative (beta = -0.01, 95% CI [-0.02, -2.31e-03], t(1229) = -2.46, p = 0.014;
## Std. beta = -0.22, 95% CI [-0.39, -0.04])
## - The effect of block [Block 1] × cbq effortful control is statistically
## non-significant and negative (beta = -2.01e-03, 95% CI [-0.01, 0.01], t(1229) =
## -0.31, p = 0.756; Std. beta = -0.02, 95% CI [-0.17, 0.12])
## - The effect of block [Block 3] × cbq effortful control is statistically
## significant and negative (beta = -0.01, 95% CI [-0.03, -3.40e-04], t(1229) =
## -2.01, p = 0.044; Std. beta = -0.16, 95% CI [-0.31, -3.90e-03])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 0.02, 95% CI [-0.01, 0.06], t(1229) = 1.27, p = 0.203;
## Std. beta = 0.11, 95% CI [-0.06, 0.29])
## - The effect of block [Block 3] × anxiety c is statistically non-significant
## and positive (beta = 0.02, 95% CI [-0.02, 0.05], t(1229) = 0.79, p = 0.428;
## Std. beta = 0.07, 95% CI [-0.11, 0.25])
## - The effect of block [Block 1] × stai trait is statistically non-significant
## and negative (beta = -4.84e-04, 95% CI [-1.44e-03, 4.74e-04], t(1229) = -0.99,
## p = 0.322; Std. beta = -0.08, 95% CI [-0.23, 0.08])
## - The effect of block [Block 3] × stai trait is statistically non-significant
## and negative (beta = -1.21e-04, 95% CI [-1.13e-03, 8.83e-04], t(1229) = -0.24,
## p = 0.813; Std. beta = -0.02, 95% CI [-0.18, 0.14])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
performance::check_outliers(model3_4)
## OK: No outliers detected.
## - Based on the following method and threshold: cook (0.907).
## - For variable: (Whole model)
model3_4_x <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_trait * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
model3_4_y <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_trait +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
performance::compare_performance(model3_4, model3_4_x, model3_4_y)
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
Trait - Model -block 3 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 3", "Block 1", "Block 2"))
model3_4b <- lmer(
DLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_trait * block + (1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -1.8e-02
summary(model3_4b)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: DLPFC_avg_score ~ c_age_y_centered + c_sex + cbq_fear * block +
## cbq_effortful_control * block + anxiety_c * block + stai_trait *
## block + (1 + block | record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -3607.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2508 -0.7004 -0.0217 0.6417 3.6584
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 0.000e+00 0.000000
## blockBlock 1 1.306e-06 0.001143 NaN
## blockBlock 2 3.227e-04 0.017964 NaN -1.00
## trial (Intercept) 0.000e+00 0.000000
## Residual 2.824e-03 0.053143
## Number of obs: 1254, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3.835e-01 2.611e-02 1.127e+03 14.686
## c_age_y_centered 2.656e-03 1.378e-03 2.812e+02 1.927
## c_sexF -9.466e-04 3.370e-03 2.822e+02 -0.281
## cbq_fear -3.373e-03 2.811e-03 1.124e+03 -1.200
## blockBlock 1 -6.215e-02 3.667e-02 1.042e+03 -1.695
## blockBlock 2 -8.866e-02 4.062e-02 1.189e+02 -2.183
## cbq_effortful_control -8.503e-03 4.181e-03 1.129e+03 -2.034
## anxiety_c 4.170e-03 1.162e-02 1.123e+03 0.359
## stai_trait 3.833e-04 3.082e-04 1.124e+03 1.244
## cbq_fear:blockBlock 1 3.806e-03 3.935e-03 1.043e+03 0.967
## cbq_fear:blockBlock 2 1.123e-02 4.381e-03 1.223e+02 2.562
## blockBlock 1:cbq_effortful_control 1.162e-02 5.809e-03 1.043e+03 2.001
## blockBlock 2:cbq_effortful_control 1.366e-02 6.420e-03 1.196e+02 2.128
## blockBlock 1:anxiety_c 8.457e-03 1.646e-02 1.042e+03 0.514
## blockBlock 2:anxiety_c -1.483e-02 1.827e-02 1.198e+02 -0.812
## blockBlock 1:stai_trait -3.621e-04 4.344e-04 1.041e+03 -0.834
## blockBlock 2:stai_trait 1.199e-04 4.841e-04 1.189e+02 0.248
## Pr(>|t|)
## (Intercept) <2e-16 ***
## c_age_y_centered 0.0550 .
## c_sexF 0.7790
## cbq_fear 0.2305
## blockBlock 1 0.0904 .
## blockBlock 2 0.0310 *
## cbq_effortful_control 0.0422 *
## anxiety_c 0.7198
## stai_trait 0.2138
## cbq_fear:blockBlock 1 0.3336
## cbq_fear:blockBlock 2 0.0116 *
## blockBlock 1:cbq_effortful_control 0.0457 *
## blockBlock 2:cbq_effortful_control 0.0354 *
## blockBlock 1:anxiety_c 0.6076
## blockBlock 2:anxiety_c 0.4185
## blockBlock 1:stai_trait 0.4047
## blockBlock 2:stai_trait 0.8048
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_4, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_4b, type = "III")
report(model3_4b)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict DLPFC_avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_trait (formula: DLPFC_avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_trait * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.06. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 3, cbq_effortful_control = 0, anxiety_c = 0 and stai_trait =
## 0, is at 0.38 (95% CI [0.33, 0.43], t(1229) = 14.69, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically non-significant and positive
## (beta = 2.66e-03, 95% CI [-4.82e-05, 5.36e-03], t(1229) = 1.93, p = 0.054; Std.
## beta = 0.06, 95% CI [-1.05e-03, 0.12])
## - The effect of c sex [F] is statistically non-significant and negative (beta =
## -9.47e-04, 95% CI [-7.56e-03, 5.66e-03], t(1229) = -0.28, p = 0.779; Std. beta
## = -0.02, 95% CI [-0.14, 0.10])
## - The effect of cbq fear is statistically non-significant and negative (beta =
## -3.37e-03, 95% CI [-8.89e-03, 2.14e-03], t(1229) = -1.20, p = 0.230; Std. beta
## = -0.06, 95% CI [-0.17, 0.04])
## - The effect of block [Block 1] is statistically non-significant and negative
## (beta = -0.06, 95% CI [-0.13, 9.79e-03], t(1229) = -1.69, p = 0.090; Std. beta
## = 0.06, 95% CI [-0.07, 0.19])
## - The effect of block [Block 2] is statistically significant and negative (beta
## = -0.09, 95% CI [-0.17, -8.98e-03], t(1229) = -2.18, p = 0.029; Std. beta =
## 0.44, 95% CI [0.30, 0.59])
## - The effect of cbq effortful control is statistically significant and negative
## (beta = -8.50e-03, 95% CI [-0.02, -3.00e-04], t(1229) = -2.03, p = 0.042; Std.
## beta = -0.10, 95% CI [-0.19, -3.44e-03])
## - The effect of anxiety c is statistically non-significant and positive (beta =
## 4.17e-03, 95% CI [-0.02, 0.03], t(1229) = 0.36, p = 0.720; Std. beta = 0.02,
## 95% CI [-0.09, 0.13])
## - The effect of stai trait is statistically non-significant and positive (beta
## = 3.83e-04, 95% CI [-2.21e-04, 9.88e-04], t(1229) = 1.24, p = 0.214; Std. beta
## = 0.06, 95% CI [-0.04, 0.16])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## positive (beta = 3.81e-03, 95% CI [-3.91e-03, 0.01], t(1229) = 0.97, p = 0.334;
## Std. beta = 0.07, 95% CI [-0.07, 0.22])
## - The effect of cbq fear × block [Block 2] is statistically significant and
## positive (beta = 0.01, 95% CI [2.63e-03, 0.02], t(1229) = 2.56, p = 0.011; Std.
## beta = 0.21, 95% CI [0.05, 0.38])
## - The effect of block [Block 1] × cbq effortful control is statistically
## significant and positive (beta = 0.01, 95% CI [2.25e-04, 0.02], t(1229) = 2.00,
## p = 0.046; Std. beta = 0.13, 95% CI [2.58e-03, 0.26])
## - The effect of block [Block 2] × cbq effortful control is statistically
## significant and positive (beta = 0.01, 95% CI [1.07e-03, 0.03], t(1229) = 2.13,
## p = 0.034; Std. beta = 0.16, 95% CI [0.01, 0.30])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 8.46e-03, 95% CI [-0.02, 0.04], t(1229) = 0.51, p = 0.608;
## Std. beta = 0.04, 95% CI [-0.11, 0.19])
## - The effect of block [Block 2] × anxiety c is statistically non-significant
## and negative (beta = -0.01, 95% CI [-0.05, 0.02], t(1229) = -0.81, p = 0.417;
## Std. beta = -0.07, 95% CI [-0.24, 0.10])
## - The effect of block [Block 1] × stai trait is statistically non-significant
## and negative (beta = -3.62e-04, 95% CI [-1.21e-03, 4.90e-04], t(1229) = -0.83,
## p = 0.405; Std. beta = -0.06, 95% CI [-0.20, 0.08])
## - The effect of block [Block 2] × stai trait is statistically non-significant
## and positive (beta = 1.20e-04, 95% CI [-8.30e-04, 1.07e-03], t(1229) = 0.25, p
## = 0.804; Std. beta = 0.02, 95% CI [-0.13, 0.17])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
Plot for interaction: Fear
interaction_eff3_4 <- ggpredict(model3_4, c("cbq_fear", "block"))
interaction_eff3_4
ggplot(interaction_eff3_4, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Fear (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "DLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_F-Block_trait_DLPFC.png", width = 10, height = 8)
Plot for interaction: EC
interaction_eff3_4_b <- ggpredict(model3_4, c("cbq_effortful_control", "block"))
interaction_eff3_4_b
ggplot(interaction_eff3_4_b, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Effortful Control (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "DLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_EC-Block_trait_DLPFC.png", width = 10, height = 8)
VLPFC
State - Model -block 2 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 2", "Block 1", "Block 3"))
model3_5 <- lmer(
VLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_state * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
summary(model3_5)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: VLPFC_avg_score ~ c_age_y_centered + c_sex + cbq_fear * block +
## cbq_effortful_control * block + anxiety_c * block + stai_state *
## block + (1 + block | record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -4609.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0446 -0.6848 -0.0171 0.6586 4.0821
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 8.226e-05 0.009070
## blockBlock 1 1.008e-04 0.010038 -0.98
## blockBlock 3 3.184e-05 0.005643 -0.86 0.94
## trial (Intercept) 0.000e+00 0.000000
## Residual 1.451e-03 0.038098
## Number of obs: 1300, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3.497e-01 2.073e-02 1.142e+02 16.865
## c_age_y_centered -7.064e-04 9.865e-04 1.229e+02 -0.716
## c_sexF 1.868e-04 2.418e-03 1.236e+02 0.077
## cbq_fear -4.521e-03 2.174e-03 1.117e+02 -2.080
## blockBlock 1 2.189e-02 2.803e-02 1.185e+02 0.781
## blockBlock 3 -1.164e-02 2.683e-02 1.889e+02 -0.434
## cbq_effortful_control 5.676e-03 3.319e-03 1.167e+02 1.710
## anxiety_c 1.915e-03 8.920e-03 1.117e+02 0.215
## stai_state 1.694e-05 2.354e-04 1.118e+02 0.072
## cbq_fear:blockBlock 1 2.778e-03 2.959e-03 1.181e+02 0.939
## cbq_fear:blockBlock 3 6.517e-03 2.848e-03 1.916e+02 2.288
## blockBlock 1:cbq_effortful_control -9.672e-03 4.454e-03 1.187e+02 -2.172
## blockBlock 3:cbq_effortful_control -6.800e-03 4.265e-03 1.894e+02 -1.595
## blockBlock 1:anxiety_c 7.930e-04 1.216e-02 1.184e+02 0.065
## blockBlock 3:anxiety_c -1.147e-02 1.163e-02 1.886e+02 -0.986
## blockBlock 1:stai_state -1.493e-04 3.203e-04 1.179e+02 -0.466
## blockBlock 3:stai_state 1.546e-04 3.078e-04 1.903e+02 0.502
## Pr(>|t|)
## (Intercept) <2e-16 ***
## c_age_y_centered 0.4753
## c_sexF 0.9385
## cbq_fear 0.0398 *
## blockBlock 1 0.4364
## blockBlock 3 0.6648
## cbq_effortful_control 0.0899 .
## anxiety_c 0.8304
## stai_state 0.9428
## cbq_fear:blockBlock 1 0.3497
## cbq_fear:blockBlock 3 0.0232 *
## blockBlock 1:cbq_effortful_control 0.0319 *
## blockBlock 3:cbq_effortful_control 0.1125
## blockBlock 1:anxiety_c 0.9481
## blockBlock 3:anxiety_c 0.3253
## blockBlock 1:stai_state 0.6420
## blockBlock 3:stai_state 0.6161
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_5, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_5, type = "III")
report(model3_5)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict VLPFC_avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_state (formula: VLPFC_avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_state * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.08. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 2, cbq_effortful_control = 0, anxiety_c = 0 and stai_state =
## 0, is at 0.35 (95% CI [0.31, 0.39], t(1275) = 16.86, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically non-significant and negative
## (beta = -7.06e-04, 95% CI [-2.64e-03, 1.23e-03], t(1275) = -0.72, p = 0.474;
## Std. beta = -0.02, 95% CI [-0.08, 0.04])
## - The effect of c sex [F] is statistically non-significant and positive (beta =
## 1.87e-04, 95% CI [-4.56e-03, 4.93e-03], t(1275) = 0.08, p = 0.938; Std. beta =
## 4.69e-03, 95% CI [-0.11, 0.12])
## - The effect of cbq fear is statistically significant and negative (beta =
## -4.52e-03, 95% CI [-8.78e-03, -2.56e-04], t(1275) = -2.08, p = 0.038; Std. beta
## = -0.12, 95% CI [-0.23, -6.77e-03])
## - The effect of block [Block 1] is statistically non-significant and positive
## (beta = 0.02, 95% CI [-0.03, 0.08], t(1275) = 0.78, p = 0.435; Std. beta =
## -0.54, 95% CI [-0.68, -0.41])
## - The effect of block [Block 3] is statistically non-significant and negative
## (beta = -0.01, 95% CI [-0.06, 0.04], t(1275) = -0.43, p = 0.664; Std. beta =
## -0.53, 95% CI [-0.66, -0.39])
## - The effect of cbq effortful control is statistically non-significant and
## positive (beta = 5.68e-03, 95% CI [-8.35e-04, 0.01], t(1275) = 1.71, p = 0.087;
## Std. beta = 0.09, 95% CI [-0.01, 0.19])
## - The effect of anxiety c is statistically non-significant and positive (beta =
## 1.92e-03, 95% CI [-0.02, 0.02], t(1275) = 0.21, p = 0.830; Std. beta = 0.01,
## 95% CI [-0.10, 0.13])
## - The effect of stai state is statistically non-significant and positive (beta
## = 1.69e-05, 95% CI [-4.45e-04, 4.79e-04], t(1275) = 0.07, p = 0.943; Std. beta
## = 3.89e-03, 95% CI [-0.10, 0.11])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## positive (beta = 2.78e-03, 95% CI [-3.03e-03, 8.58e-03], t(1275) = 0.94, p =
## 0.348; Std. beta = 0.07, 95% CI [-0.08, 0.23])
## - The effect of cbq fear × block [Block 3] is statistically significant and
## positive (beta = 6.52e-03, 95% CI [9.29e-04, 0.01], t(1275) = 2.29, p = 0.022;
## Std. beta = 0.17, 95% CI [0.02, 0.32])
## - The effect of block [Block 1] × cbq effortful control is statistically
## significant and negative (beta = -9.67e-03, 95% CI [-0.02, -9.35e-04], t(1275)
## = -2.17, p = 0.030; Std. beta = -0.15, 95% CI [-0.29, -0.01])
## - The effect of block [Block 3] × cbq effortful control is statistically
## non-significant and negative (beta = -6.80e-03, 95% CI [-0.02, 1.57e-03],
## t(1275) = -1.59, p = 0.111; Std. beta = -0.11, 95% CI [-0.24, 0.02])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 7.93e-04, 95% CI [-0.02, 0.02], t(1275) = 0.07, p = 0.948;
## Std. beta = 5.27e-03, 95% CI [-0.15, 0.16])
## - The effect of block [Block 3] × anxiety c is statistically non-significant
## and negative (beta = -0.01, 95% CI [-0.03, 0.01], t(1275) = -0.99, p = 0.324;
## Std. beta = -0.08, 95% CI [-0.23, 0.08])
## - The effect of block [Block 1] × stai state is statistically non-significant
## and negative (beta = -1.49e-04, 95% CI [-7.78e-04, 4.79e-04], t(1275) = -0.47,
## p = 0.641; Std. beta = -0.03, 95% CI [-0.18, 0.11])
## - The effect of block [Block 3] × stai state is statistically non-significant
## and positive (beta = 1.55e-04, 95% CI [-4.49e-04, 7.58e-04], t(1275) = 0.50, p
## = 0.616; Std. beta = 0.04, 95% CI [-0.10, 0.17])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
model3_5_x <- lmer(
VLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_state * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
model3_5_y <- lmer(
VLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_state +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -1.2e+01
performance::compare_performance(model3_5, model3_5_x, model3_5_y)
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## best model is model3_5 <-
Plot for Interaction: Fear
interaction_eff3_5 <- ggpredict(model3_5, c("cbq_fear", "block"))
interaction_eff3_5
ggplot(interaction_eff3_5, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Fear (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "VLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_F-Block_state_VLPFC.png", width = 10, height = 8)
Plot for Interaction: EC
interaction_eff3_5_b <- ggpredict(model3_5, c("cbq_effortful_control", "block"))
interaction_eff3_5_b
ggplot(interaction_eff3_5_b, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Effortful Control (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "VLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_EC-Block_state_VLPFC.png", width = 10, height = 8)
Trait - Model -block 2 reference
nirs_per_trial_plus_qst$block <- factor(nirs_per_trial_plus_qst$block, levels = c("Block 2", "Block 1", "Block 3"))
model3_6 <- lmer(
VLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c * block + stai_trait * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
summary(model3_6)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: VLPFC_avg_score ~ c_age_y_centered + c_sex + cbq_fear * block +
## cbq_effortful_control * block + anxiety_c * block + stai_trait *
## block + (1 + block | record_id) + (1 | trial)
## Data: nirs_per_trial_plus_qst
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 5e+05))
##
## REML criterion at convergence: -4611.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0562 -0.6751 -0.0129 0.6510 4.0949
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## record_id (Intercept) 7.708e-05 0.008780
## blockBlock 1 9.408e-05 0.009700 -0.98
## blockBlock 3 3.278e-05 0.005726 -0.88 0.95
## trial (Intercept) 0.000e+00 0.000000
## Residual 1.451e-03 0.038098
## Number of obs: 1300, groups: record_id, 109; trial, 4
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3.415e-01 2.039e-02 1.132e+02 16.751
## c_age_y_centered -7.246e-04 9.800e-04 1.209e+02 -0.739
## c_sexF 9.351e-05 2.395e-03 1.214e+02 0.039
## cbq_fear -4.370e-03 2.163e-03 1.111e+02 -2.020
## blockBlock 1 2.912e-02 2.765e-02 1.199e+02 1.053
## blockBlock 3 -9.008e-03 2.659e-02 1.877e+02 -0.339
## cbq_effortful_control 5.794e-03 3.245e-03 1.158e+02 1.785
## anxiety_c -7.772e-04 9.070e-03 1.110e+02 -0.086
## stai_trait 2.369e-04 2.407e-04 1.109e+02 0.984
## cbq_fear:blockBlock 1 2.490e-03 2.950e-03 1.194e+02 0.844
## cbq_fear:blockBlock 3 6.647e-03 2.850e-03 1.898e+02 2.332
## blockBlock 1:cbq_effortful_control -9.513e-03 4.366e-03 1.201e+02 -2.179
## blockBlock 3:cbq_effortful_control -7.135e-03 4.199e-03 1.879e+02 -1.699
## blockBlock 1:anxiety_c 3.699e-03 1.239e-02 1.197e+02 0.299
## blockBlock 3:anxiety_c -1.119e-02 1.191e-02 1.873e+02 -0.940
## blockBlock 1:stai_trait -3.566e-04 3.284e-04 1.192e+02 -1.086
## blockBlock 3:stai_trait 9.634e-05 3.161e-04 1.874e+02 0.305
## Pr(>|t|)
## (Intercept) <2e-16 ***
## c_age_y_centered 0.4611
## c_sexF 0.9689
## cbq_fear 0.0457 *
## blockBlock 1 0.2944
## blockBlock 3 0.7352
## cbq_effortful_control 0.0768 .
## anxiety_c 0.9319
## stai_trait 0.3271
## cbq_fear:blockBlock 1 0.4003
## cbq_fear:blockBlock 3 0.0207 *
## blockBlock 1:cbq_effortful_control 0.0313 *
## blockBlock 3:cbq_effortful_control 0.0909 .
## blockBlock 1:anxiety_c 0.7657
## blockBlock 3:anxiety_c 0.3486
## blockBlock 1:stai_trait 0.2797
## blockBlock 3:stai_trait 0.7609
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# emm = emmeans(model3_6, ~ cbq_effortful_control*block )
# pairs(emm)
# # or for simple comparisons
# #pairs(emm, simple = "each")
anova(model3_6, type = "III")
report(model3_6)
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## boundary (singular) fit: see help('isSingular')
## Random effect variances not available. Returned R2 does not account for random effects.
## We fitted a linear mixed model (estimated using REML and BOBYQA optimizer) to
## predict VLPFC_avg_score with c_age_y_centered, c_sex, cbq_fear, block,
## cbq_effortful_control, anxiety_c and stai_trait (formula: VLPFC_avg_score ~
## c_age_y_centered + c_sex + cbq_fear * block + cbq_effortful_control * block +
## anxiety_c * block + stai_trait * block). The model included block as random
## effects (formula: list(~1 + block | record_id, ~1 | trial)). The model's
## explanatory power related to the fixed effects alone (marginal R2) is 0.08. The
## model's intercept, corresponding to c_age_y_centered = 0, c_sex = M, cbq_fear =
## 0, block = Block 2, cbq_effortful_control = 0, anxiety_c = 0 and stai_trait =
## 0, is at 0.34 (95% CI [0.30, 0.38], t(1275) = 16.75, p < .001). Within this
## model:
##
## - The effect of c age y centered is statistically non-significant and negative
## (beta = -7.25e-04, 95% CI [-2.65e-03, 1.20e-03], t(1275) = -0.74, p = 0.460;
## Std. beta = -0.02, 95% CI [-0.08, 0.04])
## - The effect of c sex [F] is statistically non-significant and positive (beta =
## 9.35e-05, 95% CI [-4.60e-03, 4.79e-03], t(1275) = 0.04, p = 0.969; Std. beta =
## 2.35e-03, 95% CI [-0.12, 0.12])
## - The effect of cbq fear is statistically significant and negative (beta =
## -4.37e-03, 95% CI [-8.61e-03, -1.27e-04], t(1275) = -2.02, p = 0.044; Std. beta
## = -0.12, 95% CI [-0.23, -3.35e-03])
## - The effect of block [Block 1] is statistically non-significant and positive
## (beta = 0.03, 95% CI [-0.03, 0.08], t(1275) = 1.05, p = 0.293; Std. beta =
## -0.54, 95% CI [-0.68, -0.41])
## - The effect of block [Block 3] is statistically non-significant and negative
## (beta = -9.01e-03, 95% CI [-0.06, 0.04], t(1275) = -0.34, p = 0.735; Std. beta
## = -0.52, 95% CI [-0.66, -0.39])
## - The effect of cbq effortful control is statistically non-significant and
## positive (beta = 5.79e-03, 95% CI [-5.72e-04, 0.01], t(1275) = 1.79, p = 0.074;
## Std. beta = 0.09, 95% CI [-9.07e-03, 0.19])
## - The effect of anxiety c is statistically non-significant and negative (beta =
## -7.77e-04, 95% CI [-0.02, 0.02], t(1275) = -0.09, p = 0.932; Std. beta =
## -5.17e-03, 95% CI [-0.12, 0.11])
## - The effect of stai trait is statistically non-significant and positive (beta
## = 2.37e-04, 95% CI [-2.35e-04, 7.09e-04], t(1275) = 0.98, p = 0.325; Std. beta
## = 0.05, 95% CI [-0.05, 0.16])
## - The effect of cbq fear × block [Block 1] is statistically non-significant and
## positive (beta = 2.49e-03, 95% CI [-3.30e-03, 8.28e-03], t(1275) = 0.84, p =
## 0.399; Std. beta = 0.07, 95% CI [-0.09, 0.22])
## - The effect of cbq fear × block [Block 3] is statistically significant and
## positive (beta = 6.65e-03, 95% CI [1.06e-03, 0.01], t(1275) = 2.33, p = 0.020;
## Std. beta = 0.18, 95% CI [0.03, 0.32])
## - The effect of block [Block 1] × cbq effortful control is statistically
## significant and negative (beta = -9.51e-03, 95% CI [-0.02, -9.47e-04], t(1275)
## = -2.18, p = 0.030; Std. beta = -0.15, 95% CI [-0.29, -0.02])
## - The effect of block [Block 3] × cbq effortful control is statistically
## non-significant and negative (beta = -7.14e-03, 95% CI [-0.02, 1.10e-03],
## t(1275) = -1.70, p = 0.089; Std. beta = -0.11, 95% CI [-0.24, 0.02])
## - The effect of block [Block 1] × anxiety c is statistically non-significant
## and positive (beta = 3.70e-03, 95% CI [-0.02, 0.03], t(1275) = 0.30, p = 0.765;
## Std. beta = 0.02, 95% CI [-0.14, 0.19])
## - The effect of block [Block 3] × anxiety c is statistically non-significant
## and negative (beta = -0.01, 95% CI [-0.03, 0.01], t(1275) = -0.94, p = 0.348;
## Std. beta = -0.07, 95% CI [-0.23, 0.08])
## - The effect of block [Block 1] × stai trait is statistically non-significant
## and negative (beta = -3.57e-04, 95% CI [-1.00e-03, 2.88e-04], t(1275) = -1.09,
## p = 0.278; Std. beta = -0.08, 95% CI [-0.22, 0.06])
## - The effect of block [Block 3] × stai trait is statistically non-significant
## and positive (beta = 9.63e-05, 95% CI [-5.24e-04, 7.17e-04], t(1275) = 0.30, p
## = 0.761; Std. beta = 0.02, 95% CI [-0.12, 0.16])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
performance::check_outliers(model3_6)
## OK: No outliers detected.
## - Based on the following method and threshold: cook (0.907).
## - For variable: (Whole model)
model3_6_x <- lmer(
VLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_trait * block +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
model3_6_y <- lmer(
VLPFC_avg_score ~ c_age_y_centered +
c_sex + cbq_fear * block + cbq_effortful_control * block + anxiety_c + stai_trait +
(1 + block | record_id) + (1 | trial),
data = nirs_per_trial_plus_qst,
control = lmerControl(
optimizer = "bobyqa",
optCtrl = list(maxfun = 5e5)
)
)
## boundary (singular) fit: see help('isSingular')
performance::compare_performance(model3_6, model3_6_x, model3_6_y)
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## Random effect variances not available. Returned R2 does not account for random effects.
## the best model is model3_6 <-
Plot for Interaction: Fear
interaction_eff3_6 <- ggpredict(model3_6, c("cbq_fear", "block"))
interaction_eff3_6
ggplot(interaction_eff3_6, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Fear (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "VLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_F-Block_trait_VLPFC.png", width = 10, height = 8)
Plot for Interaction: EC
interaction_eff3_6_b <- ggpredict(model3_6, c("cbq_effortful_control", "block"))
interaction_eff3_6_b
ggplot(interaction_eff3_6_b, aes(x, predicted, color = group)) +
geom_line(linewidth = 1.2) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.2, color = NA) +
theme_classic() +
scale_color_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_fill_manual(
name = "Block Type",
values = natparks.pals("Saguaro", 3),
labels = c(
"Block 1" = "Baseline",
"Block 2" = "Stressful",
"Block 3" = "Recovery"
)
) +
scale_x_continuous(
name = "Effortful Control (CBQ scores)"
) +
theme(
axis.text = element_text(size = 19),
axis.title = element_text(size = 20),
legend.text = element_text(size = 19),
legend.title = element_text(face = "bold", size = 19),
legend.title.align = 0.5
) +
scale_y_continuous(name = "VLPFC Neural Synchrony (predicted)", limits = c(0.29, .42), breaks = seq(0.29, .42, by = 0.02)) # Setting Y-axis limits and ticks

ggsave("figures/aim_3_EC-Block_trait_VLPFC.png", width = 10, height = 8)